package generic;

/**
 * Created by jianweilin on 16/8/21.
 */
public class GenericDemo {
    public static void main(String[] args) {
        User<String> username = new User<String>("tracy");
        User<Integer> age = new User<Integer>(24);
        User<Number> ageN = new User<Number>(24);

        getInfo(ageN);
        getInfo(age);
    }
    public static void getInfo(User<? extends Number> user){
        System.out.println(user.getInfo());
    }
}

class User<T> {
    private T info;

    public User() {
    }

    public User(T info) {
        this.info = info;
    }

    public T getInfo() {
        return info;
    }
}
